let {remote}=require('electron')
let errorDom=document.querySelector('#error')
let messageBoxDom=document.querySelector('#messageBox')
let openDom=document.querySelector('#openDialog')
let saveDom=document.querySelector('#saveDialog')
errorDom.onclick=function () { 
    remote.dialog.showErrorBox("标题","内容")
 }
messageBoxDom.onclick=function () { 
    remote.dialog.showMessageBox({
        type:'info',
        title:'提示信息',
        message:'内容',
        buttons:['ok','no']
    },function(index){
        console.log(index)
    })
}
openDom.onclick=function () { 
    remote.dialog.showOpenDialog({
        //支持选择文件和文件夹
        properties:['openDirectory','openFile']
    },(data)=>{
        //data是路径信息
        console.log(data);
    })
}
saveDom.onclick=function () {
    remote.dialog.showSaveDialog({
        title:'save file',
        //默认情况下使用的绝对目录路径、绝对文件路径或文件名
        defaultPath:"C:\Users\Administrator\Desktop",
        filters: [
            {name: 'Images', extensions: ['jpg', 'png', 'gif']},
            {name: 'Movies', extensions: ['mkv', 'avi', 'mp4']},
            {name: 'Custom File Type', extensions: ['as']},
            {name: 'All Files', extensions: ['*']}
          ]
    },(path)=>{
        //保存文件的路径
        console.log(path);
        //点击保存以后会打印保存的路径，但是不会真的保存，具体逻辑node书写
    })
}